package 多线程初阶.线程的创建方式;

import static java.lang.Thread.sleep;
//继承Thread类方式实现多线程
class MyThread extends  Thread{
    @Override
    public void run() {
        while (true){
            System.out.println("thread is run");
            try {
                sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
public class Demo1 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread=new MyThread();
        thread.run();
        while (true){
            System.out.println("main is run");
            sleep(1000);
        }
    }
}
